#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve() {
    int n, q;
    cin >> n >> q;
    vector<tuple<int, int, int>> intervals;
    for (int i = 1; i <= n; i++) {
        int l, r;
        cin >> l >> r;
        intervals.emplace_back(l, r, i);
    }
    sort(intervals.begin(), intervals.end());
    while (q--) {
        int x;
        cin >> x;
        int left = 0, right = n - 1;
        int ans = -1;
        while (left <= right) {
            int mid = (left + right) / 2;
            auto [l, r, idx] = intervals[mid];
            if (l <= x) {
                if (x <= r) {
                    ans = idx;
                    break;
                }
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        cout << ans << "\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}